﻿using System;
using System.ComponentModel;
using PostSharp.Aspects;

namespace AOPDemo.Aspects
{
    [Serializable]
    public class AsyncMethod : MethodInterceptionAspect
    {
        public override void OnInvoke(MethodInterceptionArgs args)
        {
            var bw = new BackgroundWorker();
            bw.DoWork += (sender, e) => args.Proceed();
            bw.RunWorkerAsync();
            
        }
    }
}